package vip.xiaomaoxiaoke.functiondemo.dto;

import lombok.Data;

import java.util.Map;

@Data
public class Tool {
    private String type;
    private Function function;




    public static Tool of(String methodName,String description, Map<String,ParamDescription> properties) {
        Tool tool = new Tool();
        tool.setType("function");

        Function function1 = new Function();
        function1.setName(methodName);
        function1.setDescription(description);
        Parameters parameters = new Parameters();
        parameters.setType("object");
        parameters.setProperties(properties);
        function1.setParameters(parameters);
        tool.setFunction(function1);

        return tool;
    }

    @Data
    public static class Function {
        private String name;
        private String description;
        private Parameters parameters;




    }
    @Data
    public static class Parameters {
        private String type;
        private  Map<String,ParamDescription> properties;
        private String[] required;


    }



    @Data
    public static class ParamDescription {
        private String type;
        private String description;

        public ParamDescription(String type,String description) {
            this.description = description;
            this.type =type;
        }

    }


}



